package com.pxst.merchant.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pxst.merchant.entity.SysMerchantInfoEntity;
import com.pxst.resp.ApiResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pxst.merchant.mapper.SysMerchantInfoMapper;
import com.pxst.merchant.service.SysMerchantInfoService;

import java.util.List;

/** 
* @author cheng
* @version 创建时间：2023年11月16日 上午9:21:56
*/
@Service
public class SysMerchantInfoServiceImpl extends ServiceImpl<SysMerchantInfoMapper, SysMerchantInfoEntity> implements SysMerchantInfoService {

    @Autowired
    private SysMerchantInfoMapper sysMerchantInfoMapper;
    @Override
    public ApiResp<List<SysMerchantInfoEntity>> getMerchantInfo(Long shId) {

        QueryWrapper<SysMerchantInfoEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("sh_id",shId);
        List<SysMerchantInfoEntity> list= sysMerchantInfoMapper.selectList(wrapper);
        if (!list.isEmpty()) {
            return ApiResp.paramError("该商户已存在");
        }
        return ApiResp.sucess( sysMerchantInfoMapper.selectList(wrapper));
    }
